<?php

define('_MAIN_', 1);

include 'config.inc.php';
include _ITSTOCK_LIB_DIR_.'common.inc.php';
include _ITSTOCK_INCLUDE_DIR_.'html_base.inc.php';

itstock_session_start();

$_SESSION['uri'] = $_SERVER['REQUEST_URI'];

if (!itstock_valid_login($_SESSION['user'])) {
  header("Location: index.php");
  exit();
}

header("Content-language: en");
header("Content-type: text/html; charset=utf-8");

$itstock_page_info = array(
  'title' => 'IT Stock Tool'
);
$itstock_page_info['css'] = array('bootstrap.min.css', 'main.css');
$itstock_page_info['js'] = array('jquery.min.js', 'bootstrap.min.js');

if (isset($_GET['page']) && file_exists(_ITSTOCK_PAGE_DIR_ . basename($_GET['page']) . '.inc.php')) {
  include _ITSTOCK_PAGE_DIR_ . basename($_GET['page']) . '.inc.php';
} else {
  include _ITSTOCK_PAGE_DIR_ . 'main.inc.php';
}
itstock_db_close_all();
?>
